/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aqu.persistencia.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Verito Ramirez
 *         Victor Jaramillo
 */
@Entity
@Table(name = "cxp_detallefactura")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CxpDetalleFactura.findAll", query = "SELECT c FROM CxpDetalleFactura c"),
    @NamedQuery(name = "CxpDetalleFactura.findBycxpCodigoDetfac", query = "SELECT c FROM CxpDetalleFactura c WHERE c.cxpCodigoDetfac = :cxpCodigoDetfac"),
    @NamedQuery(name = "CxpDetalleFactura.findBycxpDescripcionDetfac", query = "SELECT c FROM CxpDetalleFactura c WHERE c.cxpDescripcionDetfac = :cxpDescripcionDetfac"),
    @NamedQuery(name = "CxpDetalleFactura.findBycxpCantidadDetfac", query = "SELECT c FROM CxpDetalleFactura c WHERE c.cxpCantidadDetfac = :cxpCantidadDetfac"),
    @NamedQuery(name = "CxpDetalleFactura.findBycxpCodigoCabfac", query = "SELECT c FROM CxpDetalleFactura c WHERE c.cxpCodigoCabfac = :cxpCodigoCabfac"),
    @NamedQuery(name = "CxpDetalleFactura.findBycxpCodigoRet", query = "SELECT c FROM CxpDetalleFactura c WHERE c.cxpCodigoRet = :cxpCodigoRet"),
    @NamedQuery(name = "CxpDetalleFactura.findBycxpAplicaRetDetFact", query = "SELECT c FROM CxpDetalleFactura c WHERE c.cxpAplicaRetDetFact = :cxpAplicaRetDetFact"),
    @NamedQuery(name = "CxpDetalleFactura.findBycxpAplicaIvaDetFac", query = "SELECT c FROM CxpDetalleFactura c WHERE c.cxpAplicaIvaDetFac = :cxpAplicaIvaDetFac")})
public class CxpDetalleFactura implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 15)
    @Column(name = "CXP_CODIGO_DETFAC")
    private String cxpCodigoDetfac;
    @Size(max = 200)
    @Column(name = "CXP_DESCRIPCION_DETFAC")
    private String cxpDescripcionDetfac;
    @Column(name = "CXP_CANTIDAD_DETFAC")
    private double cxpCantidadDetfac;    
    @JoinColumn(name = "CXP_CODIGO_CABFAC", referencedColumnName = "CXP_CODIGO_CABFAC")
    @ManyToOne(optional = false)
    private CxpCabeceraFactura cxpCodigoCabfac;
    @JoinColumn(name = "CXP_CODIGO_RET", referencedColumnName = "CXP_CODIGO_RET")
    @ManyToOne(optional = true)
    private CxpRetencion cxpCodigoRet;
    @Size(max = 2)
    @Column(name = "CXP_APLICARET_DETFAC")
    private String cxpAplicaRetDetFact;
    @Size(max = 2)
    @Column(name = "CXP_APLICAIVA_DETFAC")
    private String cxpAplicaIvaDetFac;

    public CxpDetalleFactura() {
    }

    public CxpDetalleFactura(String cxpCodigoDetfac) {
        this.cxpCodigoDetfac = cxpCodigoDetfac;
    }

    public String getCxpAplicaIvaDetFac() {
        return cxpAplicaIvaDetFac;
    }

    public void setCxpAplicaIvaDetFac(String cxpAplicaIvaDetFac) {
        this.cxpAplicaIvaDetFac = cxpAplicaIvaDetFac;
    }

    public double getCxpCantidadDetfac() {
        return cxpCantidadDetfac;
    }

    public CxpRetencion getCxpCodigoRet() {
        return cxpCodigoRet;
    }

    public void setCxpCodigoRet(CxpRetencion cxpCodigoRet) {
        this.cxpCodigoRet = cxpCodigoRet;
    }

    public String getCxpAplicaRetDetFact() {
        return cxpAplicaRetDetFact;
    }

    public void setCxpAplicaRetDetFact(String cxpAplicaRetDetFact) {
        this.cxpAplicaRetDetFact = cxpAplicaRetDetFact;
    }
    
    public void setCxpCantidadDetfac(double cxpCantidadDetfac) {
        this.cxpCantidadDetfac = cxpCantidadDetfac;
    }

    public CxpCabeceraFactura getCxpCodigoCabfac() {
        return cxpCodigoCabfac;
    }

    public void setCxpCodigoCabfac(CxpCabeceraFactura cxpCodigoCabfac) {
        this.cxpCodigoCabfac = cxpCodigoCabfac;
    }

    public String getCxpCodigoDetfac() {
        return cxpCodigoDetfac;
    }

    public void setCxpCodigoDetfac(String cxpCodigoDetfac) {
        this.cxpCodigoDetfac = cxpCodigoDetfac;
    }

    public String getCxpDescripcionDetfac() {
        return cxpDescripcionDetfac;
    }

    public void setCxpDescripcionDetfac(String cxpDescripcionDetfac) {
        this.cxpDescripcionDetfac = cxpDescripcionDetfac;
    }

    
    
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cxpCodigoDetfac != null ? cxpCodigoDetfac.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CxpDetalleFactura)) {
            return false;
        }
        CxpDetalleFactura other = (CxpDetalleFactura) object;
        if ((this.cxpCodigoDetfac == null && other.cxpCodigoDetfac != null) || (this.cxpCodigoDetfac != null && !this.cxpCodigoDetfac.equals(other.cxpCodigoDetfac))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pppp.CxpDetallefactura[ cxpCodigoDetfac=" + cxpCodigoDetfac + " ]";
    }
    
}
